//
// Created by hunan on 2025/10/2.
//

#ifndef OPEN_NET_BW_STATISTIC_H
#define OPEN_NET_BW_STATISTIC_H
#include <cstdint>
#include <atomic>
#include <memory>

class Loop;
class TimerTask;
class BWStatistic
{
public:
    BWStatistic(Loop * loop);
    void Statistic();
    void StartStatistic(uint32_t interval_second);
    void operator+=(int number);
    void StopStatistic();
private:
    Loop * m_loop;
    std::shared_ptr<TimerTask> m_timer_task;
    uint32_t m_interval_second;
    std::atomic<uint32_t> m_statistic_num;
    std::atomic<uint64_t> m_statistic_tm;
};

#endif // OPEN_NET_BW_STATISTIC_H
